home *** CD-ROM | disk | FTP | other *** search
- ────────────────────────────────────────────────────────────────────────────────
- ; plasmoid/deep/thc 1996:
- ; code by plasmoid/deep/thc
- ────────────────────────────────────────────────────────────────────────────────
- vsync macro
- local @@vs1, @@vs2
- mov dx,03dah ; ∙ retrace sync...
- @@vs1: in al,dx
- test al,8
- jnz @@vs1 ; ∙ while not in display do.
- @@vs2: in al,dx
- test al,8
- jz @@vs2 ; ∙ while in display do
- endm
- ────────────────────────────────────────────────────────────────────────────────
- .model small
- .stack 400
- .code
- .386
- locals
- scrwidth equ 80
- initheight equ 00
- vgaseg equ 0a000h
- ────────────────────────────────────────────────────────────────────────────────
- .startup
- c_site: jmp main
- info db "∙ code by plasmoid of deep ∙"
- ────────────────────────────────────────────────────────────────────────────────
- realplasma proc
- mov y,0
- inc counti
- inc od
- sub c,6 ; ∙ normally 2!
- mov al,od
- mov d,al
-
- @real2: mov al,y ; ∙ y loop
- mov bx,ax
- shl ax,8 ; ∙ mul bx sucks...
- shl bx,6 ; ∙ shifting rules!
- add ax,bx
-
- mov bx,ax
- mov al,y
- xor ah,ah
- and al,1
- add ax,bx
- mov scroff,ax
-
- mov al,counti
- xor ah,ah
- and al,1
- xor ah,ah
- mov bx,ax
- shl ax,8 ; ∙ mul bx sucks...
- shl bx,6 ; ∙ shifting rules!
- add ax,bx
-
- mov bx,scroff
- sub bx,ax ; ∙ sub k
- mov scroff,bx
-
- mov al,c
- add al,y
- and ax,255
- mov di,ax
- mov al,sint[di] ; ∙ sin((c+y) and 255)
- mov a,al
-
- mov al,d
- and al,255
- mov di,ax
- mov al,sint[di] ; ∙ sin(d and 255)
- mov b,al
- add d,6
-
- xor ax,ax
- xor bx,bx
- mov cx,256/2 ; ∙ length of plasma
-
- @real1: mov al,a
- add al,b
- mov di,ax
- mov al,ft[di] ; ∙ ft[a+b]
- mov bx,ax ; ∙ store value
- inc bx
- mov al,y
- add al,b
- mov di,ax
- mov al,ft[di] ; ∙ ft[y+b]
- add ax,bx ; ∙ get stored value
- shr ax,3
- inc al
- mov color,al
-
- mov di,scroff ; ∙ screenoffset
-
- push di
- push ax
- push cx
- mov cx,di
- mov al,04 ; ∙ read mask
- mov ah,cl ; ∙ x position
- and ah,3
- mov dx,3ceh
- out dx,ax
- shr di,2
- mov al,es:[di+8+57*80]
- cmp al,00h ; ∙ color above starz?
- je noplot
- pop cx
- pop ax
- pop di
-
- plot: push ax
- push cx
- mov cx,di
- mov ax,0102h
- and cl,03
- shl ah,cl
- mov dx,3c4h
- out dx,ax
- pop cx
- pop ax
- shr di,2
- add al,00
- mov es:[di+8+57*80],al ; ∙ put pixel
- jmp cont
-
- noplot: pop cx
- pop ax
- pop di
- cont: mov ax,scroff
- add ax,2
- mov scroff,ax
-
- xor ah,ah
- mov al,color
- shr al,7 ; ∙inc (a,1+color shr 7)
- inc al
- xor ah,ah
- add b,6
- mov bl,al
- add a,bl
-
- loop @real9
- jmp @unreal
- @real9: jmp @real1
- @unreal: inc y
- cmp y,84
- jne @real2
- ret
-
- counti db 000h
- a db 000h
- b db 000h
- c db 000h
- d db 000h
- od db 000h
- color db 000h
- y db 000h
- scroff dw 000h
- realplasma endp
- ────────────────────────────────────────────────────────────────────────────────
- putlogo proc near
- mov si,offset vgalogo
- mov di,0
- mov bx,85
- @outer: mov cx,256
- @inner: mov al,[si]
- push di
- push ax
- push cx
- mov cx,di
- mov ax,0102h
- and cl,03
- shl ah,cl
- mov dx,3c4h
- out dx,ax
- pop cx
- pop ax
- shr di,2
- mov es:[di+8+57*80],al
- pop di
- inc di
- inc si
- loop @inner
- add di,320-256
- dec bx
- jnz @outer
- ret
- putlogo endp
- ────────────────────────────────────────────────────────────────────────────────
- convert proc near
- xor bx,bx
- @@two: mov cx,bp ; ∙ lg to cx
- @@one: xor dx,dx
- mov dl,ds:[si] ; ∙ read from srce to dl
- shl dx,4
- shr dl,4
- add dh,select
- mov ds:[di],dh
- inc di
- add dl,select
- mov ds:[di],dl
- inc di
- inc si
- loop @@one
- dec ax ; ∙ dec
- jnz @@two
- ret
- select db 00
- convert endp
- ────────────────────────────────────────────────────────────────────────────────
- ega2vga proc near
- mov si,offset logo
- mov di,offset vgalogo
- mov ax,85
- mov bp,256/2
- call convert
- ret
- ega2vga endp
- ────────────────────────────────────────────────────────────────────────────────
- checkkey proc near
- cmp byte ptr keystroke,01
- je escape
- jmp no
- escape: jmp exit
- no: ret
- checkkey endp
- ────────────────────────────────────────────────────────────────────────────────
- int_key proc near
- cli
- push ax
- in al,60h
- cmp al,01 ; ∙ escape
- je put
- mov cs:keystroke,00
- jmp none ; ∙ none
- put: mov cs:keystroke,al
- none: in al,61h
- mov ah,al
- or al,80h
- out 61h,al
- sti
- mov al,20h
- out 20h,al
- pop ax
- iret
- keystroke db 00
- int_key endp
- ────────────────────────────────────────────────────────────────────────────────
- initkeyboard proc near
- cli
- push fs
- xor dx,dx
- mov fs,dx
- mov eax,fs:[9*4]
- mov oldint9,eax
- mov ax,cs
- shl eax,16
- mov ax,offset int_key
- mov fs:[9*4],eax
- sti
- pop fs
- ret
- initkeyboard endp
- ────────────────────────────────────────────────────────────────────────────────
- killkeyboard proc near
- cli
- push fs
- xor dx,dx
- mov fs,dx
- mov eax,oldint9
- mov fs:[9*4],eax
- sti
- pop fs
- ret
- killkeyboard endp
- ────────────────────────────────────────────────────────────────────────────────
- timer proc near
- push ax
- mov al,20h
- out 20h,al
- inc cs:counter
- inc cs:int_1ch
- cmp cs:int_1ch,22
- jb no_int_1ch
- mov cs:int_1ch,00
- int 1ch
- no_int_1ch: pop ax
- iret
- counter dw 0
- int_1ch db 0
- timer endp
- ────────────────────────────────────────────────────────────────────────────────
- inittimer proc near
- cli
- push gs
- xor dx,dx
- mov gs,dx
- mov eax,gs:[8*4]
- mov oldint8,eax
- mov ax,cs
- shl eax,16
- mov ax,offset timer
- mov dx,2841 ; ∙ 140 Hz double Screen Sync
- mov gs:[8*4],eax
-
- out_it: mov al,036h ; ∙ out these things, they
- out 43h,al ; just remain a secret
- mov al,dl ; for me...
- out 40h,al
- mov al,dh
- out 40h,al
- sti
- pop gs
- ret
- inittimer endp
- ────────────────────────────────────────────────────────────────────────────────
- killtimer proc near
- push gs
- xor dx,dx
- mov gs,dx
- cli
- mov eax,oldint8
- mov gs:[8*4],eax
- jmp out_it
- killtimer endp
- ────────────────────────────────────────────────────────────────────────────────
- initvideo proc near
- call zeropalette
- mov ax,13h
- int 10h
- call zeropalette
-
- mov dx,3c0h
- mov al,30h
- out dx,al
- mov al,01100001b
- out dx,al
- mov dx,3c4h ; ∙ unchain mode!
- mov ax,604h
- out dx,ax
- mov dx,3d4h ; ∙ four chain mode
- mov ax,14h
- out dx,ax
- mov ax,0e317h
- out dx,ax
- mov dx,3c4h ; ∙ all planes
- mov ax,0f02h
- out dx,ax
- mov dx,3ceh ; ∙ bitmasking
- mov ax,0ff08h
- out dx,ax
-
- push @data
- pop ds
- push 0a000h
- pop es
- xor di,di
- xor eax,eax
- mov cx,8000h/2
- rep stosd ; ∙ clear screen
- call setpalette
- ret
- initvideo endp
- ────────────────────────────────────────────────────────────────────────────────
- killvideo proc near
- mov ah,12h ; ∙ restore palette
- mov bl,31h
- mov al,00h
- int 10h
-
- mov ax,0003h ; ∙ text mode!
- int 10h
- ret
- killvideo endp
- ────────────────────────────────────────────────────────────────────────────────
- zeropalette proc near
- mov dx,03c8h ; ∙ port PEL write mode
- mov al,00h ; at register 00h
- out dx,al
- xor al,al
- inc dx ; ∙ port PEL data register
- mov cx,0100h*3
- @clear: out dx,al
- loop @clear
- ret
- zeropalette endp
- ────────────────────────────────────────────────────────────────────────────────
- setpalette proc near
- mov si,offset vgapalette
- mov dx,03c8h ; ∙ port PEL write mode
- mov al,00h ; at register 00h
- out dx,al
- inc dx ; ∙ port PEL data register
- mov cx,0100h*3
- rep outsb
- ret ; ∙ vga color a 100h times
- setpalette endp
- ────────────────────────────────────────────────────────────────────────────────
- doframing proc near
- inc framenumber
- ret
- doframing endp
- ────────────────────────────────────────────────────────────────────────────────
- main: call inittimer
- call initkeyboard
- call initvideo
- call ega2vga
- call putlogo
- plasma: vsync
- call doframing
- call realplasma
- call checkkey
- cmp framenumber,1335
- jmp plasma
-
- exit: call zeropalette
- call killvideo
- call killkeyboard
- call killtimer
- mov ax,4c00h
- int 21h
- ────────────────────────────────────────────────────────────────────────────────
- .data
- oldint9 dd ?
- oldint8 dd ?
-
- include fire.pal
- include f-scape.dat
- include f-plasma.dat
- ────────────────────────────────────────────────────────────────────────────────
- udataseg
- initinitial label word
- lastvalue dw ?
- lastvalue2 dw ?
-
- dw 160 dup (?)
- lastline dw 320 dup (?)
- dw 160 dup (?)
- endinitial label word
-
- initzero label word
- vgalogo db 256*85 dup (?)
-
- thisline dw 320 dup (?)
- slopes dw 320 dup (?)
- drawline dw 320 dup (?)
-
- updatescr dw ?
-
- framenumber dd ?
- hlimit dw ?
- lastslope dw ?
- endzero label word
- ────────────────────────────────────────────────────────────────────────────────
- end
-